<script lang="ts">
import cs from '~/composables/useCS';

// function defineAction<PT>(actionName: string, run: () => void, normalizeParam: (param: any) => PT = () => ({})) {
//   return {
//     [actionName]: {
//       assert(param: any): param is PT {
//         return param?.action === actionName;
//       },
//       normalize: normalizeParam,
//       run,
//     },
//   };
// }

// const actionMap = {
//   ...defineAction('openWallet', () => {}),
// };
</script>

<script setup lang="ts">
const isAuthed = useAuthed();
const { searchParams } = new URL(location.href);
const action = searchParams.get('action');

if (action === 'openWallet') {
  isAuthed && globalPopups.wallet.open();
}
else if (action === 'openService') {
  isAuthed && cs.show();
}
</script>

<template>
  <div data-name="action-manager" />
</template>
